import cookieStore from "@/base/js/cookieStore"
const restTimelength=60;
let state={
    islogin:cookieStore.getCookie("islogin")?cookieStore.getCookie("islogin"):false,
    userId:cookieStore.getCookie("userId")?cookieStore.getCookie("userId"):null,
    userImg:cookieStore.getCookie("userImg")?cookieStore.getCookie("userImg"):null,
    userName:cookieStore.getCookie("userName")?cookieStore.getCookie("userName"):null,
    restTime:restTimelength,
    hometoDetails:{}
}
const mutations={
    add(state){
        state.count++;
    },
    reduce(state){
        --state.restTime;
    },
    login(){
        state.islogin=true;
    },
    SaveUserId(state,payload){
        state.userId=payload;
    },
    SaveUserImg(stat,payload){
        state.userImg=payload;
    },
    SaveUserName(stat,payload){
        state.userName=payload;
    },
    resetTime(state){
    	state.restTime=restTimelength;
    },
    hometoDetailsStore(state,payload){
        state.hometoDetails=payload;
    }
}
const getters = {
    count:function(state){
        return state.restTime;
    }
}
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex)
export default new Vuex.Store({
	state,
	mutations,
	getters
})